package com.xqls.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xqls.bean.DischargeRealdataBean;
import com.xqls.dal.dao.DischargeRealdataDao;
import com.xqls.dal.model.DischargeRealdata;

import com.xqls.service.DischargeRealdataService;
import com.xqls.util.ObjectUtil;

@Service
public class DischargeRealdataServiceImpl implements DischargeRealdataService{

	@Autowired private DischargeRealdataDao realdataDao;
	@Override
	public boolean insertDischargeRealdata(DischargeRealdataBean dischargeRealdataBean) {
		DischargeRealdata realdata=(DischargeRealdata) ObjectUtil.transfer(dischargeRealdataBean, DischargeRealdata.class);
			return realdataDao.insertDischargeRealdata(realdata)>0;
		}
	@Override
		public boolean updateDischargeRealdata(DischargeRealdataBean dischargeRealdataBean) {
			DischargeRealdata realdata=(DischargeRealdata) ObjectUtil.transfer(dischargeRealdataBean, DischargeRealdata.class);
			return realdataDao.updateDischargeRealdata(realdata)>0;
		}
	
	public DischargeRealdataBean queryByRealdataNo(Integer realdataNo){
		return (DischargeRealdataBean) ObjectUtil.transfer(realdataDao.queryByRealdataNo(realdataNo), DischargeRealdataBean.class);
	}
	@Override
	public List<Map<String, Object>> selectByMap(Map<String, Object> map) {
		return realdataDao.selectByMap(map);
	}
	
	public DischargeRealdataBean queryByDeviceNo(String deviceNo){
		return (DischargeRealdataBean) ObjectUtil.transfer(realdataDao.selectByDeviceNo(deviceNo), DischargeRealdataBean.class);
	}
	
	public List<Map<String, Object>> queryAll(){
		return realdataDao.queryAll();
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<DischargeRealdataBean> selectListByMap(Map<String, Object> map) {
		return ObjectUtil.transferList(realdataDao.selectListByMap(map),DischargeRealdataBean.class);
	}

	@Override
	public List<DischargeRealdata> selectDischarge() {
		return realdataDao.selectDischarge();
	}

}
